<%-- 
    Document   : ManuelUtilisateur
    Created on : 2 juin 2014, 16:57:32
    Author     : illamhat
--%>

<%@page import="java.io.BufferedInputStream"%>
<%@page import="java.io.FileInputStream"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
  
       // AnnuairePDF annuaire = new AnnuairePDF("Z:/temp/test.pdf", "Annuaire de formations UPX", "DIPLOME");
  
                      
                        String fileName= "/var/www/html/ManuelAnnuaire.pdf";
                        FileInputStream fileInput = new FileInputStream(fileName);
                        int numOfBytes = fileInput.available();
                        response.setContentLength(numOfBytes);
                        ServletOutputStream stream = response.getOutputStream();
                        BufferedInputStream fif = new BufferedInputStream(fileInput);
                        response.setHeader("Content-Type", "application/comma-separated-values; charset=ISO-8859-1");
                        response.setHeader("Content-Disposition", "attachement;filename=manuelUtilisateur.pdf");
                        byte[] buffer = new byte[1024];
                        while (true) {
                            int bytesRead = fif.read(buffer, 0, buffer.length);
                            if (bytesRead < 0) {
                                break;
                            }
                            stream.write(buffer, 0, bytesRead);
                        }
                        stream.flush();
                        stream.close();
                        fif.close();
                    
        
    %>
    </body>
</html>
